<template>
	<el-dialog v-model="imageShow" :width="350" @close="cancel">
		<div style="text-align: center;" id="print-link">
			<el-image style="width: 150px; height: 150px" :src="src" :preview-src-list="srcList" :zoom-rate="1.2"
				:initial-index="0" fit="cover" />
<!-- 			<div style="    margin-top: 10px;"><el-button type="primary" size="small"
					@click="saveCanvasAsImage">保存图片</el-button></div> -->
		</div>
	</el-dialog>
</template>

<script>
	import {
		ElLoading
	} from 'element-plus'
	
	export default {
		emits:[
			"close"
		],
		props: {
			src: String,
			srcList: Array
		},
		data() {
			return {
				imageShow: true,
			}
		},
		mounted() {
		},
		methods: {
			cancel(){
				this.$emit("close")
			},
			saveCanvasAsImage() {
				let link = document.createElement('a');
				link.style.display = 'none';
				console.log(this.src);
				link.href = this.src;
				link.download = this.fileName + '.jpg'; // 设置下载的文件名
				document.getElementById("print-link").appendChild(link); // 添加到body以便触发点击事件
				link.click();
				// 清理：移除<a>元素并释放blob URL
				document.getElementById("print-link").removeChild(link);
			},



		}
	}
</script>

<style>
</style>